import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    windowHeight: wx.getSystemInfoSync().windowHeight,
    name: "", // 家长名称
    telphone: "", // 家长电话
    avatar: "", // 添加的孩子头像
    childId: "", // 孩子id
    childName: "", // 添加的孩子名字
    sex: "", // 添加的孩子性别
    birthday: "", // 添加的孩子生日
    idCard: "", // 添加的孩子身份证
    height: "", // 添加的孩子身高
    weight: "", // 添加的孩子体重A
    clothingSize: "", // 添加的孩子衣服尺寸
    footSize: "", // 添加的孩子鞋子尺寸
    packageList: {}, // 缓存套餐信息，用于生成套餐订单
  },
  mutations: {
    setName: (state, val) => {
      state.name = val;
    },
    setTelphone: (state, val) => {
      state.telphone = val;
    },

    setChildId: (state, val) => {
      state.childId = val;
    },
    setAvatar: (state, val) => {
      state.avatar = val;
    },
    setChildName: (state, val) => {
      state.childName = val;
    },
    setSex: (state, val) => {
      state.sex = val;
    },
    setBirthday: (state, val) => {
      state.birthday = val;
    },
    setIdCard: (state, val) => {
      state.idCard = val;
    },
    setHeight: (state, val) => {
      state.height = val;
    },
    setWeight: (state, val) => {
      state.weight = val;
    },
    setClothingSize: (state, val) => {
      state.clothingSize = val;
    },
    setFootSize: (state, val) => {
      state.footSize = val;
    },
    setPackageList: (state, val) => {
      state.packageList = val;
    }
  }
});
